package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.CustomerReturnList;
import com.atguigu.jxc.service.CustomerReturnListGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/customerReturnListGoods")
public class CustomerReturnListGoodsController {


    @Autowired
    private CustomerReturnListGoodsService customerReturnListGoodsService;
    /** 
     * @description:  客户退货单保存
     * /localhost:8080/customerReturnListGoods/save?returnNumber=XT1605772786
     * @param: returnNumber 
     * @return: com.atguigu.jxc.domain.ServiceVO 
     * @author hxy
     * @date: 2023/2/10 16:00
     */ 
    @RequestMapping("save")
    public ServiceVO save(@PathVariable Integer returnNumber,
                          CustomerReturnList customerReturnList,
                          String customerReturnListGoodsStr){
       return customerReturnListGoodsService.save(customerReturnList, customerReturnListGoodsStr);
    }
    /**
     * http://localhost:8080/customerReturnListGoods/list
     * @description:  客户退货单查询（可查询条件：退货单号、客户、退款状态）
     * @param: returnNumber
    customerId
    state
    sTime
    eTime 
     * @return: java.util.Map<java.lang.String,java.lang.Object> 
     * @author hxy
     * @date: 2023/2/11 9:33
     */ 
    @RequestMapping("list")
    public Map<String,Object> list(String returnNumber,
                                   Integer customerId,
                                   Integer state,
                                   String sTime,
                                   String eTime){
        return customerReturnListGoodsService.list(returnNumber, customerId, state, sTime, eTime);
    }
    /** 
     * @description:、退货单商品信息
     * http://localhost:8080/customerReturnListGoods/goodsList
     * @param: customerReturnListId 
     * @return: java.util.Map<java.lang.String,java.lang.Object> 
     * @author hxy
     * @date: 2023/2/11 9:34
     */ 
    @RequestMapping("goodsList")
    public Map<String,Object> goodsList(Integer customerReturnListId){
        return customerReturnListGoodsService.goodsList(customerReturnListId);
    }

    @RequestMapping("delete")
    public ServiceVO delete (Integer customerReturnListId){
        return customerReturnListGoodsService.delete(customerReturnListId);

    }
}
